package demo1;

public class Test {

	public static void main(String[] args) {
		String str = " a1234 ad *#& ( s2";
		String trim = str.trim();
		System.out.println(trim);
		int yinWen = 0;
		int kongGe = 0;
		int shuZi = 0;
		int qiTa = 0;
		for(int i =0;i<trim.length();i++){
			char c = trim.charAt(i);
			if((c >='a' && c <= 'z') || (c >='A' && c <= 'Z')){
				yinWen++;
				System.out.println("英文"+c);
			}else if(c >= '0' && c <= '9'){
				shuZi++;
				System.out.println("数字"+c);
			}else if(c == ' '){
				kongGe++;
				System.out.println("空格"+c);
			}else{
				qiTa++;
				System.out.println("其他"+c);
			}
		}
		
		System.out.println("英文数量="+yinWen+",数字数量="+shuZi+",空格数量="+kongGe+",其他="+qiTa);
	}
}
